using System;
using L=Science.Physics.GeneralPhysics;

namespace Serway.Chapter15
{
	/// <summary>
	/// Example03: A Block-Spring System
	/// A 200 g block connected to a light spring for which the 
	/// force constant is 5.00 N/m is free to oscillate on a 
	/// horizontal, frictionless surface. The block is constracted 
	/// 5.00 cm from equilibrium and released from rest, as in 
	/// Figure 15.7.
	/// (A) Find the period of its motion.
	/// T = 1.26 sec
	/// (B) Determine the maximum speed of the block.
	/// v_{max} = 0.25 m/s
	/// (C) What is the maximum acceleration of the block?
	/// a_{max} = 1.25 m/s^2
	/// (D) Express the position, speed, and acceleration 
	/// as functions of time.
	/// x(t) =  0.05 \cos 5t
	/// v(t) = -0.25 \sin 5t
	/// a(t) = -1.25 \cos 5t
	/// </summary>
	public class Example03
	{
		public Example03()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
		public void Compute()
		{
			L.SimpleHarmonicMotion shm = new L.SimpleHarmonicMotion();
			shm.Amplitude = 0.05;
			shm.Mass = 0.2;
			shm.SpringForceConstant = 5.0;
			shm.FindAngularFrequencyOfMassSpringSystem();
			shm.PhaseConstant = 0.0;

			//(A)
			shm.FindPeriodFromAngularFrequency();
			result+="(A)"+Convert.ToString(shm.Period)+"\r\n";
			//(B) 
			result+="(B)"+Convert.ToString(shm.VelocityMaximum)+"\r\n";
			//(C)
			result+="(C)"+Convert.ToString(shm.AccelerationMaximum)+"\r\n";		
		}
	}
}
